# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>

pkgname=python-treq
pkgver=22.2.0
pkgrel=3
pkgdesc="A requests-like API built on top of twisted.web's Agent"
arch=('any')
license=('MIT')
url='https://github.com/twisted/treq'
depends=('python-incremental' 'python-requests' 'python-pyopenssl' 'python-service-identity'
         'python-idna' 'python-attrs' 'python-twisted' 'python-hyperlink')
makedepends=('python-setuptools' 'httpbin')
source=("https://github.com/twisted/treq/archive/release-$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('fa69bde03be083236fee7bd8adfd549578eb46f7dbb51d2a5acb1923a8e7d047d81de0a0c9ac407ac7ac6f11a677ffa57a6203b7fd139534eb698d987f019d69')

build() {
  cd treq-release-$pkgver
  python setup.py build
}

check() {
  cd treq-release-$pkgver
  PYTHONDONTWRITEBYTECODE=1 PYTHONPATH="$PWD/build/lib" trial treq
}

package() {
  cd treq-release-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
